package com.hertz.appr.service.timer;

import java.util.List;

import org.apache.log4j.Logger;

import com.hertz.appr.pojo.db.Task;
import com.hertz.appr.service.TaskService;

public class Timer4Task {

	private Logger log = Logger.getLogger(Timer4Task.class);
	private TaskService taskService;
	private Integer writeCounts;
	private boolean running;
	
	public void dealTask(){
		log.info("timer 4 task start");
		List<Task> list = taskService.getTask(Task.TASK_STATUS_WAIT, "qq");
		taskService.dealTask(writeCounts, list);
		log.info("timer 4 task end");
	}
	
	public void destroy(){
		log.info("~~~~~~~destroy task timer");
		while(running){
			log.info("task timer is running");
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	public TaskService getTaskService() {
		return taskService;
	}
	public void setTaskService(TaskService taskService) {
		this.taskService = taskService;
	}

	public Integer getWriteCounts() {
		return writeCounts;
	}

	public void setWriteCounts(Integer writeCounts) {
		this.writeCounts = writeCounts;
	}
	
}
